/*
 * Filename    : Scene_Logo.java
 * Projectname : SoiScene
 * Date        : Jan 3, 2013 , 12:20:05 PM 
 * 
 */

package id.pratama.soiscene.scene;

import id.pratama.soiscene.IManageableScene;
import id.pratama.soiscene.MainActivity;
import id.pratama.soiscene.SceneManager;
import id.pratama.soiscene.config.IApps_Data;
import id.pratama.soiscene.config.IApps_Define;


import org.andengine.engine.handler.timer.ITimerCallback;
import org.andengine.engine.handler.timer.TimerHandler;
import org.andengine.entity.scene.Scene;
import org.andengine.entity.scene.background.Background;
import org.andengine.entity.text.Text;
import org.andengine.ui.activity.BaseGameActivity;
import org.andengine.util.color.Color;

public class Scene_Logo extends Scene implements IManageableScene, IApps_Data, IApps_Define
{
	Text				txtLogo;
	BaseGameActivity	activity;
	float				timer;
	SceneManager		sm;

	public Scene_Logo(BaseGameActivity pActivity)
	{
		// TODO Auto-generated constructor stub
		activity = pActivity;
		sm = new SceneManager(activity);
		timer = 0;
		loadResources();
		applyResources();
		registerUpdateHandler();

	}

	@Override
	public void loadResources()
	{
		// TODO Auto-generated method stub
		setBackground(new Background(Color.WHITE));
		txtLogo = new Text(0, 0, MainActivity.mFont, "Sound Of Indonesia", activity.getVertexBufferObjectManager());

	}

	@Override
	public void applyResources()
	{
		// TODO Auto-generated method stub
		attachChild(txtLogo);
		txtLogo.setPosition(RES_WIDTH / 2 - txtLogo.getWidth() / 2, RES_HEIGHT / 2 - txtLogo.getHeight() / 2);

	}

	@Override
	public void registerUpdateHandler()
	{
		// TODO Auto-generated method stub
		this.registerUpdateHandler(new TimerHandler(3f, new ITimerCallback()
		{

			@Override
			public void onTimePassed(TimerHandler pTimerHandler)
			{
				// TODO Auto-generated method stub
				Scene_Logo.this.unregisterUpdateHandler(pTimerHandler);
				sm.setScene(SceneManager.SCENE_MENU);
			}
		}));

	}

	@Override
	public void unloadResources()
	{
		// TODO Auto-generated method stub

	}

}
